<template>


  <button @click="next">下一页</button>
  {{name}} ---{{age}} ---{{json}}
</template>

<script>
import { defineComponent, onMounted, onUnmounted,ref } from "vue";
import { useRouter } from "vue-router";

export default defineComponent({
  setup() {
    console.log("setup");
    onMounted(() => {
      console.log("onMounted");
    });

    onUnmounted(() => {
        console.log("onUnmounted")
    });

    let router = useRouter();
    let name  = ref("Alice")
    let age = ref(11)
    let json = ref({
      o:10,
      h:"10000"
    })
    let next = () => {
      router.push({
        name: "Next",
        params: {
          name: name.value,
          age: age.value,
          json: json.value,
        },
      });
    };
    return {
      next,
      name,
      age,
      json
    };
  },
});
</script>
